<?php

namespace Admintmd\Controller;
use Think\Controller;

class CaijiController extends BaseController{


	public function add_points($order_id,$userid,$points){
		$res = M('user')->where("id = $userid")->setInc('points',$points);
		if($res){
			$res1 = M('order')->where("id = $order_id")->setField(array('is_add'=>'1','add_points'=>$points));
		}
		if($res && $res1){
			return 1;
		}
	}



    public function taimian() {

        $type=0;
        //添加下期数据
//        $next_number = date('Ymd');
        $next_number=700001;
        $next_info = M("hundred")->where("type='$type'")->find();
        if(!$next_info) {
            $next_data = array(
                'period_number' => $next_number,
                'type' => $type,
                'add_time' => time(),
            );
            M("hundred")->add($next_data);
        }
        $this -> display();
    }
    public function taimian_lh() {

        $type=1;
        //添加下期数据
        $next_number = date('Ymd');
        $next_number=700001;
        $next_info = M("hundred")->where("type='$type'")->find();
        if(!$next_info) {
            $next_data = array(
                'period_number' => $next_number,
                'type' => $type,
                'add_time' => time(),
            );
            M("hundred")->add($next_data);
        }
        $this -> display();
    }

    function ss(){
        dejiang();
    }
}

?>